home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / execd1200.iso / Shareware / Blocks 3 / setup.exe / Source / ANIMATE.C next >
Encoding:
C/C++ Source or Header  |  2000-10-06  |  1.1 KB  |  56 lines

  1. #include <allegro.h>
  2. #include <jgmod.h>
  3. #include <blocks3.h>
  4.  
  5. void Animate(void)
  6. {
  7.  int i;
  8.  
  9.  for (i = 0; i < ani_count; i++)
  10.  {
  11.   if (ani[i].type == SPLASH) Ani_Splash(i);
  12.  }
  13. }
  14.  
  15. void Ani_Splash(int a)
  16. {
  17.  ani[a].frame++;
  18.  
  19.  if (ani[a].frame/10 == 0) DirtyList(ani[a].x, ani[a].y, ani[a].z, 32, 32, splash_pic[0]);
  20.  if (ani[a].frame/10 == 1) DirtyList(ani[a].x, ani[a].y, ani[a].z, 32, 32, splash_pic[1]);
  21.  if (ani[a].frame/10 == 2) DirtyList(ani[a].x, ani[a].y, ani[a].z, 32, 32, splash_pic[2]);
  22.  if (ani[a].frame/10 == 3) DirtyList(ani[a].x, ani[a].y, ani[a].z, 32, 32, splash_pic[3]);
  23.  
  24.  if (ani[a].frame/10 == 4)
  25.  {
  26.   DirtyList(ani[a].x, ani[a].y, ani[a].z, 32, 32, blank);
  27.   Del_Ani(a);
  28.  }
  29. }
  30.  
  31. void Del_Ani(int a)
  32. {
  33.  int i;
  34.  
  35.  for (i = a; i < ani_count; i++)
  36.  {
  37.   ani[i].x = ani[i + 1].x;
  38.   ani[i].y = ani[i + 1].y;
  39.   ani[i].z = ani[i + 1].z;
  40.   ani[i].type = ani[i + 1].type;
  41.   ani[i].frame = ani[i + 1].frame;
  42.  }
  43.  
  44.  ani_count--;
  45. }
  46.  
  47. void Add_Ani(int x, int y, int z, int type)
  48. {
  49.  ani[ani_count].x = x;
  50.  ani[ani_count].y = y;
  51.  ani[ani_count].z = z;
  52.  ani[ani_count].type = type;
  53.  
  54.  ani_count++;
  55. }
  56.